import Vue from 'vue'

export default {
    data() {
        return {}
    },
    props: {
        show: {type: Boolean, required: true},
        appendToBody: {type: Boolean, required: false, default: true},
        closeOnClickModal: { type: Boolean, default: false,}
    },
    mounted() {
    },
    watch: {
        // show () {
        // 	this.$emit('update:show', this.show)
        // },
    },
    methods: {
        hidden() {
            this.$emit('update:show', false)
            this.$emit('close', false)
        },
        async hiddenReset() {
            this.$emit('update:show', false)
            await this._restForm();
            Object.assign(this.$data, this.$options.data())
        },
        async _restForm (form = 'form') {
            if (this.$refs[form]) {
                this.$refs[form].resetFields()
                this.$refs[form].clearValidate()
            }
        },
    },
}
